const express = require('express')
const fs = require('fs')
const config = require(process.cwd() + '/src/config/config')
const Game = require(process.cwd() + '/src/class/index')

let router = express.Router()

const doAction = async (req) => {
  // 获取准备资源
  let result = await Game.Map.getPreparations(req.body.preparations)
  return result
}

/* GET users listing. */
router.post('/', function(req, res) {
  doAction(req).then((data) => {
    res.json(data)
  })
  .catch((err) => {
    console.log(err)
    res.sendStatus(500)
  })
})

module.exports = router
